<!DOCTYPE html>
<html>
<head hexo-theme='https://volantis.js.org/#2.6.6'>
  <meta charset="utf-8">
  <!-- SEO相关 -->
  
    
  
  <!-- 渲染优化 -->
  <meta name="renderer" content="webkit">
  <meta name="force-rendering" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  <meta name="HandheldFriendly" content="True" >
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  <!-- 页面元数据 -->
  
    <title>Hexo网站搭建教程 - BY HJY - Jun&#39;s Blog</title>
  
    <meta name="keywords" content="Web,Hexo">
  
  
    <meta name="description" content="写在前面
我们这里采用的是hexo工具来生成博客网站的方案, 我们简单介绍一下它的基本构架.
整个方案分为三大部分: 其一是博客本身, 其二是部署到服务器, 其三是多人协作.">
  

  <!-- feed -->
  
    <link rel="alternate" href="/junblog/atom.xml" title="Jun's Blog">
  

  <!-- import meta -->
  

  <!-- link -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.13/css/all.min.css">
  
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css">

  
  
    
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.css">

  

  
  <link rel="shortcut icon" type='image/x-icon' href="https://cdn.jsdelivr.net/gh/xaoxuu/assets@master/favicon/favicon.ico">
  

  

  

  <!-- import link -->
  

  
  
    
<link rel="stylesheet" href="/junblog/css/style.css">

  

  <script>
    function setLoadingBarProgress(num) {
      document.getElementById('loading-bar').style.width=num+"%";
    }
  </script>

  
  
</head>

<body>
  
  <div id="loading-bar-wrapper">
  <div id="loading-bar"></div>
</div>
<header class="l_header shadow blur">
  <div class='container'>
  <div class='wrapper'>
    <div class='nav-sub'>
      <p class="title"></p>
      <ul class='switcher nav-list-h'>
        <li><a class="s-comment fas fa-comments fa-fw" target="_self" href='javascript:void(0)'></a></li>
        
          <li><a class="s-toc fas fa-list fa-fw" target="_self" href='javascript:void(0)'></a></li>
        
      </ul>
    </div>
		<div class="nav-main">
      
        
        <a class="title flat-box" target="_self" href='/junblog/'>
          
          
          
            Jun's Blog
          
          
        </a>
      

			<div class='menu navigation'>
				<ul class='nav-list-h'>
          
          
          
            
            
              <li>
                <a class="flat-box" href=/junblog/
                  
                  
                  
                    id="junblog"
                  >
                  <i class='fas fa-rss fa-fw'></i>首页
                </a>
                
              </li>
            
          
          
            
            
              <li>
                <a class="flat-box" href=/junblog/categories/
                  
                  
                  
                    id="junblogcategories"
                  >
                  <i class='fas fa-folder-open fa-fw'></i>分类
                </a>
                
              </li>
            
          
          
            
            
              <li>
                <a class="flat-box" href=/junblog/tags/
                  
                  
                  
                    id="junblogtags"
                  >
                  <i class='fas fa-tags fa-fw'></i>标签
                </a>
                
              </li>
            
          
          
            
            
              <li>
                <a class="flat-box" href=/junblog/archives/
                  
                  
                  
                    id="junblogarchives"
                  >
                  <i class='fas fa-archive fa-fw'></i>归档
                </a>
                
              </li>
            
          
          
            
            
              <li>
                <a class="flat-box" href=/junblog/friends/
                  
                  
                  
                    id="junblogfriends"
                  >
                  <i class='fas fa-link fa-fw'></i>友链
                </a>
                
              </li>
            
          
          
            
            
              <li>
                <a class="flat-box" href=/junblog/aboutme/
                  
                  
                  
                    id="junblogaboutme"
                  >
                  <i class='fas fa-info-circle fa-fw'></i>关于
                </a>
                
              </li>
            
          
          
				</ul>
			</div>

      <div class="m_search">
        <form name="searchform" class="form u-search-form">
          <i class="icon fas fa-search fa-fw"></i>
          <input type="text" class="input u-search-input" placeholder="Search..." />
        </form>
      </div>

			<ul class='switcher nav-list-h'>
				
					<li><a class="s-search fas fa-search fa-fw" target="_self" href='javascript:void(0)'></a></li>
				
				<li>
          <a class="s-menu fas fa-bars fa-fw" target="_self" href='javascript:void(0)'></a>
          <ul class="menu-phone list-v navigation white-box">
            
              
            
              <li>
                <a class="flat-box" href=/junblog/
                  
                  
                  
                    id="junblog"
                  >
                  <i class='fas fa-rss fa-fw'></i>首页
                </a>
                
              </li>
            
          
            
              
            
              <li>
                <a class="flat-box" href=/junblog/categories/
                  
                  
                  
                    id="junblogcategories"
                  >
                  <i class='fas fa-folder-open fa-fw'></i>分类
                </a>
                
              </li>
            
          
            
              
            
              <li>
                <a class="flat-box" href=/junblog/tags/
                  
                  
                  
                    id="junblogtags"
                  >
                  <i class='fas fa-tags fa-fw'></i>标签
                </a>
                
              </li>
            
          
            
              
            
              <li>
                <a class="flat-box" href=/junblog/archives/
                  
                  
                  
                    id="junblogarchives"
                  >
                  <i class='fas fa-archive fa-fw'></i>归档
                </a>
                
              </li>
            
          
            
              
            
              <li>
                <a class="flat-box" href=/junblog/friends/
                  
                  
                  
                    id="junblogfriends"
                  >
                  <i class='fas fa-link fa-fw'></i>友链
                </a>
                
              </li>
            
          
            
              
            
              <li>
                <a class="flat-box" href=/junblog/aboutme/
                  
                  
                  
                    id="junblogaboutme"
                  >
                  <i class='fas fa-info-circle fa-fw'></i>关于
                </a>
                
              </li>
            
          
            
          </ul>
        </li>
			</ul>
		</div>
	</div>
  </div>
</header>

<script>setLoadingBarProgress(40);</script>



  <div class="l_body nocover">
    <div class='body-wrapper'>
      

<div class='l_main'>
  

  
    <article id="post" class="post white-box reveal blur article-type-post" itemscope itemprop="blogPost">
      


  <section class='meta'>
    
      
      
      <div class="meta" id="header-meta">
        
          
  <h1 class="title">
    <a href="/junblog/2021/01/20/hexo%E7%BD%91%E7%AB%99%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B%20-%20BY%20HJY/">
      Hexo网站搭建教程 - BY HJY
    </a>
  </h1>


        
        <div class='new-meta-box'>
          
            
          
            
              
<div class='new-meta-item author'>
  <a href="" rel="nofollow">
    <img src="https://cdn.jsdelivr.net/gh/JunyuanHe/cdn-assets@master/img/GeographicObjects2.jpg">
    <p>Jun</p>
  </a>
</div>

            
          
            
              
  
  <div class='new-meta-item category'>
    <a href='/junblog/categories/%E8%AE%A1%E7%AE%97%E6%9C%BA/Web%E5%BC%80%E5%8F%91/' rel="nofollow">
      <i class="fas fa-folder-open fa-fw" aria-hidden="true"></i>
      <p>计算机/Web开发</p>
    </a>
  </div>


            
          
            
              <div class="new-meta-item date">
  <a class='notlink'>
    <i class="fas fa-calendar-alt fa-fw" aria-hidden="true"></i>
    <p>发布于：2021年1月20日 16:44</p>
  </a>
</div>

            
          
            
              

            
          
        </div>
        
          <hr>
        
      </div>
    
  </section>


      <section class="article typo">
        <div class="article-entry" itemprop="articleBody">
          
          
          <h2 id="写在前面">写在前面</h2>
<p>我们这里采用的是hexo工具来生成博客网站的方案, 我们简单介绍一下它的基本构架.</p>
<p>整个方案分为三大部分: 其一是博客本身, 其二是部署到服务器, 其三是多人协作.</p>
<a id="more"></a>
<h3 id="a-博客本身">a) 博客本身</h3>
<p>构建博客大体的思路如下. 我们建立一个文件夹存放博客网站的所有内容并用hexo初始化, 在该文件夹里面会出现几个特别的文件夹和文件:</p>
<ul>
<li><strong>node_modules：是npm的依赖包</strong></li>
<li><strong>public：存放的是生成的页面</strong></li>
<li>scaffolds：命令生成文章等的模板</li>
<li><strong>source：用命令创建的各种文章</strong></li>
<li><strong>themes：主题</strong></li>
<li>**_config.yml：整个博客的配置**</li>
<li>db.json：source解析所得到的</li>
<li>package.json：项目所需模块项目的配置信息</li>
</ul>
<p>我们在source下的_post文件夹里编写我们需要发布的文档, 然后通过hexo命令(<code>hexo g</code>)将它们转化为可以查看的HTML网页写入public文件夹. 接着就已经可以用本机作为服务器查看网页了(<code>hexo s</code>).</p>
<h3 id="b-部署到服务器">b) 部署到服务器</h3>
<p>生成的网站我们当然希望别人能够在互联网上面看到, 这就要求我们拥有一个彻夜运行的服务器, 并且允许所有人访问. 我们这里采用的是gitee, github, coding此类代码协作平台的静态网站业务, 这项业务允许我们把任意的代码上传, 由此生成静态网站并分配域名. 这样, 别人就可以通过此域名访问我们的网站了.</p>
<p>网站的部署, 说白了就是把public文件夹中的内容上传到代码仓库(<code>hexo d</code>). 当然, 要完成这项工作, 需要事先将本机与代码托管平台进行连接. 为了避免每次输入账号密码, 我们采用SSH公钥的方式让代码托管平台认识到我们这台计算机是可以信任的.</p>
<h3 id="c-多人协作">c) 多人协作</h3>
<p>使用git来进行版本控制. 基本思路是使用两个仓库nju2019mathtalk和nju2019mathtalk_code.</p>
<p>nju2019mathtalk存放我们生成的静态网站, 由hexo deploy时自动部署, 无需特殊人为干预</p>
<p>nju2019mathtalk_code存放我们所有代码文件, 每个人编辑之前必须记得从远端克隆仓库(或者拉取), 以保证使用的是最新版本. 然后在修改完成后将仓库push到远端.</p>
<p>注: 如果两个人同时进行修改, 并且修改的是同一文件的同一行, push的时候就会报错. 这时候在VSCode中可以查看不同版本的比较, 可以选择保留哪一个版本(不过要和对方商量一下, 不要擅做主张哦)</p>
<h2 id="准备工作">准备工作</h2>
<ul class="task-list">
<li><input type="checkbox" disabled>
安装git</li>
<li><input type="checkbox" disabled>
安装Node.js</li>
<li><input type="checkbox" disabled>
安装hexo(在node.js中安装)</li>
<li><input type="checkbox" disabled>
安装typora并配置</li>
</ul>
<h3 id="安装hexo">安装hexo</h3>
<p>安装hexo命令：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm i -g hexo</span><br></pre></td></tr></table></figure>
<h3 id="修改typora配置">修改typora配置</h3>
<p>打开latex行间公式</p>
<p>修改图片默认保存文件夹的名字为文件名</p>
<h2 id="正式搭建">正式搭建</h2>
<h3 id="初始化hexo">初始化hexo</h3>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo init</span><br></pre></td></tr></table></figure>
<h3 id="连接上gitee">连接上gitee</h3>
<p><strong>(1)创建SSH</strong></p>
<p>在博客根目录中进入gitbash</p>
<ul>
<li>回到gitbash中，配置git账户信息（YourName和YourEail都替换成你自己的）：</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ git config --global user.name <span class="string">"YourName"</span></span><br><span class="line">$ git config --global user.email <span class="string">"YourEmail"</span></span><br></pre></td></tr></table></figure>
<figure>
<img src="/junblog/2021/01/20/hexo%E7%BD%91%E7%AB%99%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B%20-%20BY%20HJY/image-20210119173245944.png" alt="image-20210119173245944"><figcaption aria-hidden="true">image-20210119173245944</figcaption>
</figure>
<p>直接进入gitbash</p>
<ul>
<li>在gitbash中输入：<code>ssh-keygen -t rsa -C "youremail@example.com"</code>，生成ssh。找到<code>id_rsa.pub</code>文件的内容, 在<code>C:\Users\username\.ssh</code>文件夹内</li>
</ul>
<figure>
<img src="/junblog/2021/01/20/hexo%E7%BD%91%E7%AB%99%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B%20-%20BY%20HJY/image-20210119155655116.png" alt="image-20210119155655116"><figcaption aria-hidden="true">image-20210119155655116</figcaption>
</figure>
<p><strong>(2) 修改_config.yml的一些配置</strong></p>
<ul>
<li>用编辑器打开你的blog项目，修改<code>_config.yml</code>文件的一些配置(冒号之后都是有一个半角空格的)：</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  repo: git@gitee.com:heliumhe&#x2F;nju19mathtalk.git</span><br><span class="line">  branch: master</span><br></pre></td></tr></table></figure>
<ul>
<li>回到gitbash中，进入你的blog目录，分别执行以下命令：</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ hexo clean</span><br><span class="line">$ hexo generate</span><br><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>
<p>注：hexo 3.0把服务器独立成个别模块，需要单独安装：<code>npm i hexo-server</code>。</p>
<ul>
<li>打开浏览器输入：<code>http://localhost:4000</code></li>
<li>接着你就可以遇见天使的微笑了~</li>
</ul>
<blockquote>
<p>deploy的时候如果遇到如下错误:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ hexo d</span><br><span class="line">ERROR Deployer not found: git</span><br></pre></td></tr></table></figure>
<p>就执行</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>
<p>然后重新deploy</p>
</blockquote>
<p><strong>(3) 上传到gitee</strong></p>
<ul>
<li>先安装一波：<code>npm install hexo-deployer-git --save</code>（这样才能将你写好的文章部署到gitee服务器上并让别人浏览到）</li>
<li>执行命令(建议每次都按照如下步骤部署)：</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">$ hexo clean</span><br><span class="line">$ hexo generate</span><br><span class="line">$ hexo server     (可以在部署前在本地查看)</span><br><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>
<blockquote>
<p>注: 可能出现的错误解决方案</p>
<p>补全缺失的环境(适用于node_modules里面内容不全): 在网站文件夹下使用</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm install</span><br></pre></td></tr></table></figure>
<p>安装stylus渲染器</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm i -S hexo-renderer-stylus</span><br></pre></td></tr></table></figure>
<p>安装hexo的mathjax渲染器</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm install hexo-filter-mathjax</span><br></pre></td></tr></table></figure>
</blockquote>
<h2 id="如何发布文章">如何发布文章</h2>
<p>如果不考虑多人协作问题, 发布文章很简单. 最简单(但不太规范的方式): 直接使用markdown写作, 然后复制到post文件夹, 加上YAML头部信息区, 然后执行那三个命令, 最后到gitee代码仓库中找到静态网站, 按一下更新即可.</p>
<p>最安全的方法:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 第一步: </span></span><br><span class="line"><span class="comment">## a.较安全的思路: 删除nju2019mathtalk_code整个文件夹, 从云端clone整个文件夹(在外层文件夹里面操作)</span></span><br><span class="line">$ git <span class="built_in">clone</span> git@gitee.com:heliumhe/nju2019mathtalk_code.git</span><br><span class="line"></span><br><span class="line"><span class="comment">## b.一般的思路: 使用git pull(在里层文件夹下面操作), 如果出现conflict, 在VSCode里面手动解决冲突(accept all incoming)</span></span><br><span class="line">$ git pull origin master</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 第二步: 用hexo生成网页(nju2019mathtalk_code文件夹内)</span></span><br><span class="line">$ hexo clean</span><br><span class="line">$ hexo generate</span><br><span class="line">$ hexo server</span><br><span class="line">$ hexo deploy</span><br><span class="line"><span class="comment"># 注: 如果deploy不成功,可能需要手工删除.deploy_git文件夹</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 第三步: 在里层文件夹(nju2019mathtalk_code)里面执行</span></span><br><span class="line">$ git add .</span><br><span class="line">$ git commit -m <span class="string">"这里填修改了什么"</span></span><br><span class="line">$ git push origin master</span><br><span class="line"></span><br><span class="line"><span class="comment"># 第四步: 在gitee仓库里对静态网站进行部署的更新</span></span><br></pre></td></tr></table></figure>
<blockquote>
<p>注: git push 操作常常会出现如下错误</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">$ git push origin master</span><br><span class="line"></span><br><span class="line">fatal: HttpRequestException encountered.</span><br><span class="line">An error occurred <span class="keyword">while</span> sending the request.</span><br><span class="line">Username <span class="keyword">for</span> <span class="string">'https://github.com'</span>: cherispanty</span><br><span class="line">To https://github.com/cherispanty/demo.git</span><br><span class="line">! [rejected]        master -&gt; master (fetch first)</span><br><span class="line">error: failed to push some refs to <span class="string">'https://github.com/cherispanty/demo.git'</span></span><br><span class="line">hint: Updates were rejected because the remote contains work that you <span class="keyword">do</span></span><br><span class="line">hint: not have locally. This is usually caused by another repository pushing</span><br><span class="line">hint: to the same ref. You may want to first integrate the remote changes</span><br><span class="line">hint: (e.g., <span class="string">'git pull ...'</span>) before pushing again.</span><br><span class="line">hint: See the <span class="string">'Note about fast-forwards'</span> <span class="keyword">in</span> <span class="string">'git push --help'</span> <span class="keyword">for</span> details.</span><br></pre></td></tr></table></figure>
<p>原因是我的这个版本不是服务器上最新的版本，恰巧我本地的代码和远程仓库的代码在同一个文件的同一行做了修改，因此产生了冲突，这是我们应该先使用git pull命令更新最新的代码再上传。</p>
<p>pull一下，发现产生了冲突：</p>
<p>如何解决？打开冲突的文件，删除不必要的部分（不要乱删别人的代码，最好和别人协商一下），保存退出文件</p>
<p>再add，commit，push。（注意commit操作不要加文件名）(此过程中自动进入merge模式)</p>
</blockquote>
<blockquote>
<p>git简单教程: https://www.bootcss.com/p/git-guide/</p>
</blockquote>
<h2 id="利用git同步代码">利用git同步代码</h2>
<h3 id="初始化">初始化</h3>
<p>配置git账户信息完成后</p>
<p>输入</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git init</span><br></pre></td></tr></table></figure>
<p>来完成初始化工作</p>
<h3 id="添加推送源">添加推送源</h3>
<p>现在继续在终端上输入如下命令，增加对我们github上创建的仓库的管理。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git remote add origin git@gitee.com:heliumhe/nju2019mathtalk_code.git</span><br></pre></td></tr></table></figure>
<h3 id="当本地没有仓库的副本时-将远程仓库克隆clone下来">当本地没有仓库的副本时, 将远程仓库克隆clone下来</h3>
<p>然后使用clone命令, 把远程仓库内容克隆到本地</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> git@gitee.com:heliumhe/nju2019mathtalk_code.git</span><br></pre></td></tr></table></figure>
<p>(以后每次更新内容时: 先删除, 再克隆, 然后修改文件, 部署, 推送到远程分支)</p>
<h3 id="把仓库内容同步到本地pull">把仓库内容同步到本地pull</h3>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git pull git@gitee.com:heliumhe/nju2019mathtalk_code.git</span><br></pre></td></tr></table></figure>
<h3 id="把本地内容同步到仓库add-commit-push">把本地内容同步到仓库add, commit, push</h3>
<ul>
<li>首先执行增加命令，如下：</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git add .     （这后面是一个英文的句号）</span><br></pre></td></tr></table></figure>
<p>add后面加了一个点，是想要提交所有文件，如果想提交指定的文件，可以写文件名.</p>
<ul>
<li>执行完增加命令后，要执行提交命令，如下：</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git commit –m “这里写下你自己的记录本次提交内容的信息”</span><br></pre></td></tr></table></figure>
<p>-m后面跟提示信息，这个提示信息是一定要写的，不仅是规则，同时也方便我们记录我们提交的过程，写清晰为什么提交或修改了什么是非常有用的</p>
<ul>
<li>提交完成后，我们就要把它推送到远程仓库上去了，命令如下：</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git push git@gitee.com:heliumhe/nju2019mathtalk_code.git</span><br></pre></td></tr></table></figure>
<p>这样就完成了我们要做的所有任务</p>

          
            <div class='article_footer'>
              
                
  
    
    



  

  
    
    



  

  
    
    

    <section class="widget copyright  desktop mobile">
        <div class='content'>
            
                <blockquote>
                    
                        
                                    <p>博客内容遵循 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议。转载请保留原文链接和作者。</p>

                                        
                                            
                </blockquote>
                
        </div>
    </section>
  

  


              
            </div>
          
        </div>
        
          


  <section class='meta' id="footer-meta">
    <div class='new-meta-box'>
      
        
          <div class="new-meta-item date" itemprop="dateUpdated" datetime="2021-01-20T16:45:08+08:00">
  <a class='notlink'>
    <i class="fas fa-edit fa-fw" aria-hidden="true"></i>
    <p>更新于：2021年1月20日 16:45</p>
  </a>
</div>

        
      
        
          
  
  <div class="new-meta-item meta-tags"><a class="tag" href="/junblog/tags/Web/" rel="nofollow"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i><p>Web</p></a></div> <div class="new-meta-item meta-tags"><a class="tag" href="/junblog/tags/Hexo/" rel="nofollow"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i><p>Hexo</p></a></div>


        
      
        
          
  <div class="new-meta-item share -mob-share-list">
  <div class="-mob-share-list share-body">
    
      
        <a class="-mob-share-qq" title="" rel="external nofollow noopener noreferrer"
          
          href="http://connect.qq.com/widget/shareqq/index.html?url=https://heliumhe.gitee.io/2021/01/20/hexo%E7%BD%91%E7%AB%99%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B%20-%20BY%20HJY/&title=Hexo网站搭建教程 - BY HJY - Jun's Blog&summary=写在前面
我们这里采用的是hexo工具来生成博客网站的方案, 我们简单介绍一下它的基本构架.
整个方案分为三大部分: 其一是博客本身, 其二是部署到服务器, 其三是多人协作."
          
          >
          
            <img src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-assets/logo/128/qq.png">
          
        </a>
      
    
      
        <a class="-mob-share-qzone" title="" rel="external nofollow noopener noreferrer"
          
          href="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=https://heliumhe.gitee.io/2021/01/20/hexo%E7%BD%91%E7%AB%99%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B%20-%20BY%20HJY/&title=Hexo网站搭建教程 - BY HJY - Jun's Blog&summary=写在前面
我们这里采用的是hexo工具来生成博客网站的方案, 我们简单介绍一下它的基本构架.
整个方案分为三大部分: 其一是博客本身, 其二是部署到服务器, 其三是多人协作."
          
          >
          
            <img src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-assets/logo/128/qzone.png">
          
        </a>
      
    
      
        <a class="-mob-share-weibo" title="" rel="external nofollow noopener noreferrer"
          
          href="http://service.weibo.com/share/share.php?url=https://heliumhe.gitee.io/2021/01/20/hexo%E7%BD%91%E7%AB%99%E6%90%AD%E5%BB%BA%E6%95%99%E7%A8%8B%20-%20BY%20HJY/&title=Hexo网站搭建教程 - BY HJY - Jun's Blog&summary=写在前面
我们这里采用的是hexo工具来生成博客网站的方案, 我们简单介绍一下它的基本构架.
整个方案分为三大部分: 其一是博客本身, 其二是部署到服务器, 其三是多人协作."
          
          >
          
            <img src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-assets/logo/128/weibo.png">
          
        </a>
      
    
      
        
        <div class='hoverbox'>
          <a><img src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-assets/logo/128/wechat.png"></a>
          <div class='target'>
            <img src="">
          </div>
        </div>
      
    
  </div>
</div>



        
      
    </div>
  </section>


        
        
          <div class="prev-next">
            
              <a class='prev' href='/junblog/2021/01/23/%E6%95%B0%E6%8D%AE%E5%BA%93%E6%A6%82%E8%AE%BA%E5%A4%8D%E4%B9%A0/'>
                <p class='title'><i class="fas fa-chevron-left" aria-hidden="true"></i>数据库概论知识点总结</p>
                <p class='content'>数据库系统的基本概念
从数据到数据库
数据
数据的概念
数据：数据的内容是信息；数据的表现形式是符号记录
数据的分类

按数据加工程度分：分为三次数据、二次数据、一次数据、零次数据...</p>
              </a>
            
            
              <a class='next' href='/junblog/2020/09/16/%E5%A4%8D%E5%88%B6%E6%96%87%E4%BB%B6%E6%97%B6%E6%97%A0%E6%B3%95%E8%AF%BB%E5%8F%96%E6%BA%90%E6%96%87%E4%BB%B6%E6%88%96%E7%A3%81%E7%9B%98%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88/'>
                <p class='title'>复制文件时"无法读取源文件或磁盘"的解决方案记录<i class="fas fa-chevron-right" aria-hidden="true"></i></p>
                <p class='content'>一段时间以前电脑上某些特定的文件开始出现无法复制、剪切的情况。一旦进行复制、剪切的操作，速度在某点处降到几乎为0，复制操作卡死，无法暂停或取消，2-3 min 后，系统弹出提示框，“无法读取源文...</p>
              </a>
            
          </div>
        
      </section>
    </article>
  

  
    <!-- 显示推荐文章和评论 -->



  <article class="post white-box reveal comments blur">
    <section class="article typo">
      <p ct><i class='fas fa-comments'></i> 评论</p>
      
        <p cst>读者们可以在此处进行交流</p>
      
      
      
      
      
      
        <section id="comments">
          <div id="valine_container" class="valine_thread">
            <i class="fas fa-cog fa-spin fa-fw fa-2x"></i>
          </div>
        </section>
      
      
    </section>
  </article>


  




<!-- 根据页面mathjax变量决定是否加载MathJax数学公式js -->



  <script>
    window.subData = {
      title: 'Hexo网站搭建教程 - BY HJY',
      tools: true
    }
  </script>


</div>
<aside class='l_side'>
  
  
    
    



  <section class="widget toc-wrapper blur desktop mobile" id="toc-div" >
    
  <header>
    
      <i class="fas fa-list fa-fw" aria-hidden="true"></i><span class='name'>本文目录</span>
    
  </header>


    <div class='content'>
        <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#写在前面"><span class="toc-number">1.</span> <span class="toc-text">写在前面</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#a-博客本身"><span class="toc-number">1.1.</span> <span class="toc-text">a) 博客本身</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#b-部署到服务器"><span class="toc-number">1.2.</span> <span class="toc-text">b) 部署到服务器</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#c-多人协作"><span class="toc-number">1.3.</span> <span class="toc-text">c) 多人协作</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#准备工作"><span class="toc-number">2.</span> <span class="toc-text">准备工作</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#安装hexo"><span class="toc-number">2.1.</span> <span class="toc-text">安装hexo</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#修改typora配置"><span class="toc-number">2.2.</span> <span class="toc-text">修改typora配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#正式搭建"><span class="toc-number">3.</span> <span class="toc-text">正式搭建</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#初始化hexo"><span class="toc-number">3.1.</span> <span class="toc-text">初始化hexo</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#连接上gitee"><span class="toc-number">3.2.</span> <span class="toc-text">连接上gitee</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#如何发布文章"><span class="toc-number">4.</span> <span class="toc-text">如何发布文章</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#利用git同步代码"><span class="toc-number">5.</span> <span class="toc-text">利用git同步代码</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#初始化"><span class="toc-number">5.1.</span> <span class="toc-text">初始化</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#添加推送源"><span class="toc-number">5.2.</span> <span class="toc-text">添加推送源</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#当本地没有仓库的副本时-将远程仓库克隆clone下来"><span class="toc-number">5.3.</span> <span class="toc-text">当本地没有仓库的副本时, 将远程仓库克隆clone下来</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#把仓库内容同步到本地pull"><span class="toc-number">5.4.</span> <span class="toc-text">把仓库内容同步到本地pull</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#把本地内容同步到仓库add-commit-push"><span class="toc-number">5.5.</span> <span class="toc-text">把本地内容同步到仓库add, commit, push</span></a></li></ol></li></ol>
    </div>
  </section>


  


</aside>


  
  <footer class="clearfix">
    <br><br>
    
      
        <div class="aplayer-container">
          


        </div>
      
    
      
        <br>
        <div class="social-wrapper">
          
            
              <a href="/junblog/atom.xml"
                class="social fas fa-rss flat-btn"
                target="_blank"
                rel="external nofollow noopener noreferrer">
              </a>
            
          
            
              <a href="mailto:hejunyuan02@126.com"
                class="social fas fa-envelope flat-btn"
                target="_blank"
                rel="external nofollow noopener noreferrer">
              </a>
            
          
            
              <a href="https://music.163.com/#/user/home?id=63035382"
                class="social fas fa-headphones-alt flat-btn"
                target="_blank"
                rel="external nofollow noopener noreferrer">
              </a>
            
          
        </div>
      
    
      
        本站使用
        <a href="https://volantis.js.org/" target="_blank" class="codename">Volantis</a>
        作为主题，总访问量为
          <span id="busuanzi_value_site_pv"><i class="fas fa-circle-notch fa-spin fa-fw" aria-hidden="true"></i></span>
          次
        
      
    
      
        <div class='copyright'>
        <p><a href="https://junyuanhe.github.io/" target="_blank" rel="noopener">Copyright © 2019-2020 Jun</a></p>

        </div>
      
    
  </footer>

<script>setLoadingBarProgress(80);</script>


      <script>setLoadingBarProgress(60);</script>
    </div>
    <a class="s-top fas fa-arrow-up fa-fw" href='javascript:void(0)'></a>
  </div>
  
<script src="https://cdn.jsdelivr.net/npm/jquery@3.4/dist/jquery.min.js"></script>


  <script>
    
    var SEARCH_SERVICE = "hexo" || "hexo";
    var ROOT = "/junblog/" || "/";
    if (!ROOT.endsWith('/')) ROOT += '/';
  </script>





  <script async src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-volantis@2/js/instant_page.js" type="module" defer integrity="sha384-OeDn4XE77tdHo8pGtE1apMPmAipjoxUQ++eeJa6EtJCfHlvijigWiJpD7VDPWXV1"></script>


  <script src="https://cdn.jsdelivr.net/npm/scrollreveal@4.0.6/dist/scrollreveal.min.js"></script>
  <script type="text/javascript">
    $(function() {
      ScrollReveal().reveal('.l_main .reveal', {
        distance: '8px',
        duration: '800',
        interval: '100',
        scale: '1'
      });
    });
  </script>


  
<script src="https://cdn.jsdelivr.net/npm/node-waves@0.7.6/dist/waves.min.js"></script>

  <script type="text/javascript">
    $(function() {
      Waves.attach('.flat-btn', ['waves-button']);
      Waves.attach('.float-btn', ['waves-button', 'waves-float']);
      Waves.attach('.float-btn-light', ['waves-button', 'waves-float', 'waves-light']);
      Waves.attach('.flat-box', ['waves-block']);
      Waves.attach('.float-box', ['waves-block', 'waves-float']);
      Waves.attach('.waves-image');
      Waves.init();
    });
  </script>


  <script defer src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-busuanzi@2.3/js/busuanzi.pure.mini.js"></script>



  
  
  
    
<script src="https://cdn.jsdelivr.net/npm/jquery-backstretch@2.1.18/jquery.backstretch.min.js"></script>

    <script type="text/javascript">
      $(function(){
        var imgs=["https://cdn.jsdelivr.net/gh/xaoxuu/cdn-wallpaper/abstract/41F215B9-261F-48B4-80B5-4E86E165259E.jpeg", "https://cdn.jsdelivr.net/gh/xaoxuu/cdn-wallpaper/abstract/BBC19066-E176-47C2-9D22-48C81EE5DF6B.jpeg", "https://cdn.jsdelivr.net/gh/xaoxuu/cdn-wallpaper/abstract/B18FCBB3-67FD-48CC-B4F3-457BA145F17A.jpeg", "https://cdn.jsdelivr.net/gh/xaoxuu/cdn-wallpaper/abstract/67239FBB-E15D-4F4F-8EE8-0F1C9F3C4E7C.jpeg"];
        if ('true' == 'true') {
          function shuffle(arr){
            /*From countercurrent-time*/
            var n = arr.length;
            while(n--) {
              var index = Math.floor(Math.random() * n);
              var temp = arr[index];
              arr[index] = arr[n];
              arr[n] = temp;
            }
          }
          shuffle(imgs);
        }
        if ('.cover') {
          $('.cover').backstretch(
            imgs,
          {
            duration: "20000",
            fade: "1500"
          });
        } else {
          $.backstretch(
            imgs,
          {
            duration: "20000",
            fade: "1500"
          });
        }
      });
    </script>
  











  
    
<script src="/junblog/js/valine.js"></script>

  
  <script>
  var GUEST_INFO = ['nick','mail','link'];
  var meta = 'nick,mail'.split(',').filter(function(item){
    return GUEST_INFO.indexOf(item) > -1
  });
  var REQUIRED_FIELDS = ['nick','mail','link'];
  var requiredFields = 'nick,mail'.split(',').filter(function(item){
    return REQUIRED_FIELDS.indexOf(item) > -1
  });
  var valine = new Valine();
  function emoji(path, idx, ext) {
      return path + "/" + path + "-" + idx + "." + ext;
  }
  var emojiMaps = {};
  for (var i = 1; i <= 54; i++) {
    emojiMaps['tieba-' + i] = emoji('tieba', i, 'png');
  }
  for (var i = 1; i <= 101; i++) {
    emojiMaps['qq-' + i] = emoji('qq', i, 'gif');
  }
  for (var i = 1; i <= 116; i++) {
    emojiMaps['aru-' + i] = emoji('aru', i, 'gif');
  }
  for (var i = 1; i <= 125; i++) {
    emojiMaps['twemoji-' + i] = emoji('twemoji', i, 'png');
  }
  for (var i = 1; i <= 4; i++) {
    emojiMaps['weibo-' + i] = emoji('weibo', i, 'png');
  }
  valine.init({
    el: '#valine_container',
    meta: meta,
    
    appId: "GbPm6UIzHrGduLaANgBIdhkf-gzGzoHsz",
    appKey: "SFuacIL4IJSnGk9TDX46eb0Y",
    placeholder: "快来评论吧~",
    pageSize:'10',
    avatar:'robohash',
    lang:'zh-cn',
    visitor: 'true',
    highlight: 'true',
    mathJax: 'true',
    enableQQ: 'true',
    requiredFields: requiredFields,
    emojiCDN: 'https://cdn.jsdelivr.net/gh/xaoxuu/cdn-assets/emoji/valine/',
    emojiMaps: emojiMaps
  })
  </script>





  
<script src="/junblog/js/app.js"></script>



  
<script src="https://cdn.jsdelivr.net/gh/xaoxuu/cdn-volantis@2.6.5/js/search.js"></script>







<!-- 复制 -->

  <script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
  function wait(callback, seconds) {
    var timelag = null;
    timelag = window.setTimeout(callback, seconds);
  }
  !function (e, t, a) {
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '<i class="fas fa-copy"></i><span>COPY</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      $(".article pre code").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });
      clipboard.on('success', function(e) {
        let $btn = $(e.trigger);
        $btn.addClass('copied');
        let $icon = $($btn.find('i'));
        $icon.removeClass('fa-copy');
        $icon.addClass('fa-check-circle');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPIED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('fa-check-circle');
          $icon.addClass('fa-copy');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
      clipboard.on('error', function(e) {
        e.clearSelection();
        let $btn = $(e.trigger);
        $btn.addClass('copy-failed');
        let $icon = $($btn.find('i'));
        $icon.removeClass('fa-copy');
        $icon.addClass('fa-times-circle');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPY FAILED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('fa-times-circle');
          $icon.addClass('fa-copy');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
    }
    initCopyCode();
  }(window, document);
</script>




<!-- fancybox -->
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
<script>
  function pjax_fancybox() {
    $(".article-entry").find("img").not('.inline').not('a img').each(function () { //渲染 fancybox
      var element = document.createElement("a"); // a 标签
      $(element).attr("pjax-fancybox", "");  // 过滤 pjax
      $(element).attr("href", $(this).attr("src"));
      if ($(this).attr("data-original")) {
        $(element).attr("href", $(this).attr("data-original"));
      }
      $(element).attr("data-fancybox", "images");
      var caption = "";   // 描述信息
      if ($(this).attr('alt')) {  // 标准 markdown 描述信息
        $(element).attr('data-caption', $(this).attr('alt'));
        caption = $(this).attr('alt');
      }
      var div = document.createElement("div");
      $(div).addClass("fancybox");
      $(this).wrap(div); // 最外层套 div ，其实主要作用还是 class 样式
      var span = document.createElement("span");
      $(span).addClass("image-caption");
      $(span).text(caption); // 加描述
      $(this).after(span);  // 再套一层描述
      $(this).wrap(element);  // 最后套 a 标签
    })
    $(".article-entry").find("img").fancybox({
      selector: '[data-fancybox="images"]',
      hash: false,
      loop: false,
      closeClick: true,
      helpers: {
        overlay: {closeClick: true}
      },
      buttons: [
        "zoom",
        "close"
      ]
    });
  };
  $(function () {
    pjax_fancybox();
  });
</script>





  <script>setLoadingBarProgress(100);</script>
</body>
</html>
